#二分查找

#前提：有序

aList=[1,3,5,7,9,12,13,16]

#结束条件
'''
找到了，mid的位置
没找到，start > end

'''



x = int(input("请输入查找的数："))
start = 0
end = len(aList) - 1
while start <= end:
  mid = (start + end) // 2
  if aList[mid] == x:
    break
  elif x < aList[mid]:
    end = mid - 1
  else:
    strar = mid + 1
if start <= end:
  print("找到了,第%d个数是%d。"%(mid+1,x))
else:
  print("没找到,查找的数%d在列表中"%x)
  

